package com.shr.netease;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main_1 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in) ;
		Set<Character> charSet = new HashSet<>() ;
		String str = sc.next();
		for(int i = 0;i<str.length();i++){
			charSet.add(str.charAt(i));
		}
		if(charSet.size() == 1)
			System.out.println(1);
		else if(charSet.size() == 2)
			System.out.println(2);
		else System.out.println(0);
		sc.close();
		
	}
}
